home *** CD-ROM | disk | FTP | other *** search
/ Programming Microsoft Visual Basic .NET / Programming Microsoft Visual Basic .NET (Microsoft Press)(X08-78517)(2002).bin / setup / vbnet / 16 windows forms / windowsformsdemo / calleeform.vb < prev    next >
Encoding:
Text File  |  2001-09-16  |  5.5 KB  |  150 lines

  1. Public Class CalleeForm
  2.     Inherits System.Windows.Forms.Form
  3.  
  4. #Region " Windows Form Designer generated code "
  5.  
  6.     Public Sub New()
  7.         MyBase.New()
  8.  
  9.         'This call is required by the Windows Form Designer.
  10.         InitializeComponent()
  11.  
  12.         'Add any initialization after the InitializeComponent() call
  13.         If Me.Modal Then
  14.             Me.FormBorderStyle = FormBorderStyle.FixedDialog
  15.         Else
  16.             Me.FormBorderStyle = FormBorderStyle.Sizable
  17.             Me.SizeGripStyle = SizeGripStyle.Show
  18.         End If
  19.     End Sub
  20.  
  21.     'Form overrides dispose to clean up the component list.
  22.     Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
  23.         If disposing Then
  24.             If Not (components Is Nothing) Then
  25.                 components.Dispose()
  26.             End If
  27.         End If
  28.         MyBase.Dispose(disposing)
  29.     End Sub
  30.     Private WithEvents Label1 As System.Windows.Forms.Label
  31.     Private WithEvents Label2 As System.Windows.Forms.Label
  32.     Private WithEvents txtUserName As System.Windows.Forms.TextBox
  33.     Private WithEvents txtAliasName As System.Windows.Forms.TextBox
  34.     Private WithEvents OK As System.Windows.Forms.Button
  35.     Friend WithEvents btnCancel As System.Windows.Forms.Button
  36.  
  37.     'Required by the Windows Form Designer
  38.     Private components As System.ComponentModel.Container
  39.  
  40.     'NOTE: The following procedure is required by the Windows Form Designer
  41.     'It can be modified using the Windows Form Designer.  
  42.     'Do not modify it using the code editor.
  43.     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
  44.         Me.Label1 = New System.Windows.Forms.Label()
  45.         Me.Label2 = New System.Windows.Forms.Label()
  46.         Me.OK = New System.Windows.Forms.Button()
  47.         Me.txtUserName = New System.Windows.Forms.TextBox()
  48.         Me.btnCancel = New System.Windows.Forms.Button()
  49.         Me.txtAliasName = New System.Windows.Forms.TextBox()
  50.         Me.SuspendLayout()
  51.         '
  52.         'Label1
  53.         '
  54.         Me.Label1.Location = New System.Drawing.Point(16, 24)
  55.         Me.Label1.Name = "Label1"
  56.         Me.Label1.Size = New System.Drawing.Size(232, 16)
  57.         Me.Label1.TabIndex = 0
  58.         Me.Label1.Text = "Enter your name"
  59.         '
  60.         'Label2
  61.         '
  62.         Me.Label2.Location = New System.Drawing.Point(16, 96)
  63.         Me.Label2.Name = "Label2"
  64.         Me.Label2.Size = New System.Drawing.Size(232, 16)
  65.         Me.Label2.TabIndex = 2
  66.         Me.Label2.Text = "Enter your alias"
  67.         '
  68.         'OK
  69.         '
  70.         Me.OK.Location = New System.Drawing.Point(368, 48)
  71.         Me.OK.Name = "OK"
  72.         Me.OK.Size = New System.Drawing.Size(80, 32)
  73.         Me.OK.TabIndex = 4
  74.         Me.OK.Text = "OK"
  75.         '
  76.         'txtUserName
  77.         '
  78.         Me.txtUserName.Location = New System.Drawing.Point(16, 48)
  79.         Me.txtUserName.Name = "txtUserName"
  80.         Me.txtUserName.Size = New System.Drawing.Size(328, 24)
  81.         Me.txtUserName.TabIndex = 1
  82.         Me.txtUserName.Text = ""
  83.         '
  84.         'btnCancel
  85.         '
  86.         Me.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
  87.         Me.btnCancel.Location = New System.Drawing.Point(368, 112)
  88.         Me.btnCancel.Name = "btnCancel"
  89.         Me.btnCancel.Size = New System.Drawing.Size(80, 32)
  90.         Me.btnCancel.TabIndex = 4
  91.         Me.btnCancel.Text = "Cancel"
  92.         '
  93.         'txtAliasName
  94.         '
  95.         Me.txtAliasName.Location = New System.Drawing.Point(16, 120)
  96.         Me.txtAliasName.Name = "txtAliasName"
  97.         Me.txtAliasName.Size = New System.Drawing.Size(328, 24)
  98.         Me.txtAliasName.TabIndex = 3
  99.         Me.txtAliasName.Text = ""
  100.         '
  101.         'CalleeForm
  102.         '
  103.         Me.AcceptButton = Me.OK
  104.         Me.AutoScaleBaseSize = New System.Drawing.Size(7, 17)
  105.         Me.CancelButton = Me.btnCancel
  106.         Me.ClientSize = New System.Drawing.Size(482, 207)
  107.         Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnCancel, Me.OK, Me.txtAliasName, Me.Label2, Me.txtUserName, Me.Label1})
  108.         Me.Font = New System.Drawing.Font("Microsoft Sans Serif", 11!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
  109.         Me.Name = "CalleeForm"
  110.         Me.Text = "CalleeForm"
  111.         Me.ResumeLayout(False)
  112.  
  113.     End Sub
  114.  
  115. #End Region
  116.  
  117.     ' Properties that expose relevant fields to the outside
  118.     Property UserName() As String
  119.         Get
  120.             Return txtUserName.Text
  121.         End Get
  122.         Set(ByVal Value As String)
  123.             txtUserName.Text = Value
  124.         End Set
  125.     End Property
  126.  
  127.     Property AliasName() As String
  128.         Get
  129.             Return txtAliasName.Text
  130.         End Get
  131.         Set(ByVal Value As String)
  132.             txtAliasName.Text = Value
  133.         End Set
  134.     End Property
  135.  
  136.     Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
  137.         Me.DialogResult = DialogResult.OK
  138.         ' we must explicitly close the form only if it isn't modal
  139.         ' (this is just for illustration purposes, because a simpler Me.Close works well anyway)
  140.         If Not Me.Modal Then Me.Close()
  141.     End Sub
  142.  
  143.     Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
  144.         Me.DialogResult = DialogResult.Cancel
  145.         ' we must explicitly close the form only if it isn't modal
  146.         ' (this is just for illustration purposes, because a simpler Me.Close works well anyway)
  147.         If Not Me.Modal Then Me.Close()
  148.     End Sub
  149. End Class
  150.